package model

const (
	maxPageNum      int = 1000
	maxPageSize     int = 100
	defaultPageNum  int = 1
	defaultPageSize int = 10
)

// 格式化分页
func FormatPage(pageNum, pageSize int) (int, int) {
	if pageNum <= 0 {
		pageNum = defaultPageNum
	}
	if pageSize <= 0 || pageSize > maxPageSize {
		pageSize = maxPageSize
	}
	limit := pageSize
	offset := pageSize * (pageNum - 1)
	return offset, limit
}
